<?php
include_once("dataprovider.php");

class QuanLy
{
	var $MaQuanLy;
	var $Keyword;
	var $Title;
	var $Phone;
	var $Mobile;
	var $Fax;
	var $DiaChiCongTy;
	var $DiaChiXuong;
	var $UrlBanDoCongTy;
	var $UrlBanDoXuong;
	var $Email;
	var $Sologan;
	var $LoiGioiThieu;
	
	public static function CapNhat_MotSo_ThongTin_LienLac($ql)
	{
		$sql = "
			UPDATE quanly
			SET 
				Phone = '".$ql->Phone."',
				Mobile = '".$ql->Mobile."',
				Fax = '".$ql->Fax."',
				Email = '".$ql->Email."',
				AddressCongTy = '".$ql->DiaChiCongTy."',
				AdressXuong = '".$ql->DiaChiXuong."'
			WHERE MaQuanLy=".$ql->MaQuanLy."
		"; //câu sql này chưa cập nhật 2 cái bản đồ 
		$result = DataProvider::ExecuteQuery($sql);
		return $result;
	}
	
	public static function LayTatCaThongTin()
	{
		$sql = "
			SELECT *
			FROM quanly
		";
		$result = DataProvider::ExecuteQuery($sql);
		while($row = mysql_fetch_array($result))
		{
			$ql = new QuanLy;
			$ql->MaQuanLy = $row["MaQuanLy"];
			$ql->Keyword = $row["Keyword"];
			$ql->Title = $row["Title"];
			$ql->Phone = $row["Phone"];
			$ql->Mobile = $row["Mobile"];
			$ql->Fax = $row["Fax"];
			$ql->DiaChiCongTy = $row["AddressCongTy"];
			$ql->DiaChiXuong = $row["AdressXuong"];
			$ql->UrlBanDoCongTy = $row["UrlBanDoCongTy"];
			$ql->UrlBanDoXuong = $row["UrlBanDoXuong"];
			$ql->Email = $row["Email"];
			$ql->Sologan = $row["Sologan"];
			$ql->LoiGioiThieu = $row["LoiGioiThieu"];
			return $ql;
		}
		return NULL;
	}
	
	public static function GetMaQuanLy()
	{
		$sql = "
			SELECT *
			FROM quanly
		";
		$result = DataProvider::ExecuteQuery($sql);
		$row = mysql_fetch_array($result);
		return $row["MaQuanLy"];
	}
	
	
	public static function GetKeyword()
	{
		$sql = "
			SELECT *
			FROM quanly
		";
		$result = DataProvider::ExecuteQuery($sql);
		$row = mysql_fetch_array($result);
		return $row["Keyword"];
	}
	
	public static function SetKeyword($keyw)
	{
		$maquanly = QuanLy::LayMaQuanLy();
		
		$sql = "
			UPDATE quanly
			SET Keyword='".$keyw."'
			WHERE MaQuanLy=".$maquanly."
		";
		$result = DataProvider::ExecuteQuery($sql);
		return $result;
	}
	
	
	
	public static function GetTitle()
	{
		$sql = "
			SELECT *
			FROM quanly
		";
		$result = DataProvider::ExecuteQuery($sql);
		$row = mysql_fetch_array($result);
		return $row["Title"];
	}
	
	public static function SetTitle($titl)
	{
		$maquanly = QuanLy::LayMaQuanLy();
		
		$sql = "
			UPDATE quanly
			SET Title='".$titl."'
			WHERE MaQuanLy=".$maquanly."
		";
		$result = DataProvider::ExecuteQuery($sql);
		return $result;
	}
	
	
	
	public static function GetPhone()
	{
		$sql = "
			SELECT *
			FROM quanly
		";
		$result = DataProvider::ExecuteQuery($sql);
		$row = mysql_fetch_array($result);
		return $row["Phone"];
	}
	
	public static function SetPhone($sdt)
	{
		$maquanly = QuanLy::LayMaQuanLy();
		
		$sql = "
			UPDATE quanly
			SET Phone='".$sdt."'
			WHERE MaQuanLy=".$maquanly."
		";
		$result = DataProvider::ExecuteQuery($sql);
		return $result;
	}
	
	
	
	public static function GetMobile()
	{
		$sql = "
			SELECT *
			FROM quanly
		";
		$result = DataProvider::ExecuteQuery($sql);
		$row = mysql_fetch_array($result);
		return $row["Mobile"];
	}
	
	public static function SetMobile($sdt)
	{
		$maquanly = QuanLy::LayMaQuanLy();
		
		$sql = "
			UPDATE quanly
			SET Mobile='".$sdt."'
			WHERE MaQuanLy=".$maquanly."
		";
		$result = DataProvider::ExecuteQuery($sql);
		return $result;
	}
	
	
	
	public static function GetFax()
	{
		$sql = "
			SELECT *
			FROM quanly
		";
		$result = DataProvider::ExecuteQuery($sql);
		$row = mysql_fetch_array($result);
		return $row["Fax"];
	}
	
	public static function SetFax($sofax)
	{
		$maquanly = QuanLy::LayMaQuanLy();
		
		$sql = "
			UPDATE quanly
			SET Fax='".$sofax."'
			WHERE MaQuanLy=".$maquanly."
		";
		$result = DataProvider::ExecuteQuery($sql);
		return $result;
	}
	
	
	
	public static function GetDiaChiCongTy()
	{
		$sql = "
			SELECT *
			FROM quanly
		";
		$result = DataProvider::ExecuteQuery($sql);
		$row = mysql_fetch_array($result);
		return $row["DiaChiCongTy"];
	}
	
	public static function SetDiaChiCongTy($addcty)
	{
		$maquanly = QuanLy::LayMaQuanLy();
		
		$sql = "
			UPDATE quanly
			SET DiaChiCongTy='".$addcty."'
			WHERE MaQuanLy=".$maquanly."
		";
		$result = DataProvider::ExecuteQuery($sql);
		return $result;
	}
	
	
	
	public static function GetDiaChiXuong()
	{
		$sql = "
			SELECT *
			FROM quanly
		";
		$result = DataProvider::ExecuteQuery($sql);
		$row = mysql_fetch_array($result);
		return $row["DiaChiXuong"];
	}
	
	public static function SetDiaChiXuong($addxuong)
	{
		$maquanly = QuanLy::LayMaQuanLy();
		
		$sql = "
			UPDATE quanly
			SET DiaChiXuong='".$addxuong."'
			WHERE MaQuanLy=".$maquanly."
		";
		$result = DataProvider::ExecuteQuery($sql);
		return $result;
	}
	
	
	
	public static function GetUrlBanDoCongTy()
	{
		$sql = "
			SELECT *
			FROM quanly
		";
		$result = DataProvider::ExecuteQuery($sql);
		$row = mysql_fetch_array($result);
		return $row["UrlBanDoCongTy"];
	}
	
	public static function SetUrlBanDoCongTy($url)
	{
		$maquanly = QuanLy::LayMaQuanLy();
		
		$sql = "
			UPDATE quanly
			SET UrlBanDoCongTy='".$url."'
			WHERE MaQuanLy=".$maquanly."
		";
		$result = DataProvider::ExecuteQuery($sql);
		return $result;
	}
	
	
	
	public static function GetUrlBanDoXuong()
	{
		$sql = "
			SELECT *
			FROM quanly
		";
		$result = DataProvider::ExecuteQuery($sql);
		$row = mysql_fetch_array($result);
		return $row["UrlBanDoXuong"];
	}
	
	public static function SetUrlBanDoXuong($url)
	{
		$maquanly = QuanLy::LayMaQuanLy();
		
		$sql = "
			UPDATE quanly
			SET UrlBanDoXuong='".$url."'
			WHERE MaQuanLy=".$maquanly."
		";
		$result = DataProvider::ExecuteQuery($sql);
		return $result;
	}
	
	
	
	public static function GetEmail()
	{
		$sql = "
			SELECT *
			FROM quanly
		";
		$result = DataProvider::ExecuteQuery($sql);
		$row = mysql_fetch_array($result);
		return $row["Email"];
	}
	
	public static function SetEmail($mail)
	{
		$maquanly = QuanLy::LayMaQuanLy();
		
		$sql = "
			UPDATE quanly
			SET Email='".$mail."'
			WHERE MaQuanLy=".$maquanly."
		";
		$result = DataProvider::ExecuteQuery($sql);
		return $result;
	}
	
	
	
	public static function GetSologan()
	{
		$sql = "
			SELECT *
			FROM quanly
		";
		$result = DataProvider::ExecuteQuery($sql);
		$row = mysql_fetch_array($result);
		return $row["Sologan"];
	}
	
	public static function SetSologan($solo)
	{
		$maquanly = QuanLy::LayMaQuanLy();
		
		$sql = "
			UPDATE quanly
			SET Sologan='".$solo."'
			WHERE MaQuanLy=".$maquanly."
		";
		$result = DataProvider::ExecuteQuery($sql);
		return $result;
	}
	
	
	
	public static function GetLoiGioiThieu()
	{
		$sql = "
			SELECT *
			FROM quanly
		";
		$result = DataProvider::ExecuteQuery($sql);
		$row = mysql_fetch_array($result);
		return $row["LoiGioiThieu"];
	}
	
	public static function SetLoiGioiThieu($gt)
	{
		$maquanly = QuanLy::LayMaQuanLy();
		
		$sql = "
			UPDATE quanly
			SET LoiGioiThieu='".$gt."'
			WHERE MaQuanLy=".$maquanly."
		";
		$result = DataProvider::ExecuteQuery($sql);
		return $result;
	}
}

?>